<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ include file="global.jsp" %>
<%
  int caiGouBiaoId = ParamUtils.getIntParameter(request,"CaiGouBiaoId", -1);
  if (caiGouBiaoId == -1){
	  out.println("参数错误");
      return ;
  }

      //
      CaiGouBiaoJia cgbj = new CaiGouBiaoJia(caiGouBiaoId);
      ArrayList sps = cgbj.GetCaiGouShangPings();
      ArrayList cggss = cgbj.GetCaiGouGongSis();
      int factorys = cggss.size();
      int productorys = sps.size();
      
      //审核意见栏的宽度
      int nYiJianWidth = 59 + factorys * 12;
      
      int nUserQuanXian = UserManager.GetShenHeYuanQuanXianByUserID(pageUser.getYongHuMing());
      
      XiaLaLiebiaoInfos changYongYiJian = new XiaLaLiebiaoInfos();
      Map changyongYIJiangMap = null;

      changyongYIJiangMap = changYongYiJian.GetAllYiJian();
       
 %>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>采购比价单</title>

<style type="text/css">  
   body{margin:0px;}
   .fontff{
          TEXT-ALIGN:center;                   
   }
   .unbloud{   
            BORDER-RIGHT:   #000000   0px   solid;   BORDER-TOP:   #000000   0px   solid;   BORDER-LEFT:   #000000   0px   solid;   BORDER-BOTTOM:   #000000   1px   solid   
   }
   .unbloud_error{   
            BORDER-RIGHT:   #000000   0px   solid;   BORDER-TOP:   #000000   0px   solid;   BORDER-LEFT:   #000000   0px   solid;   BORDER-BOTTOM:   #ff0000   1px   solid   
   }
   .error{border:1px solid #ff0000;}
   .correct{font-size : 11px;}
   body,td,th,input {
	font-size: 12px;
   }
#productSearch_layer {
	position:absolute;
	padding:20px;
0 20px;	background: #D5D5D5;
	border:1px solid #999999;
	width:522px;
	height:234px;
	left:100px;
	top:138px;
	z-index:2;
}
    </style>

<link href="css/basic.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
#cyyj {
	position:absolute;
	left:528px;
	top:485px;
	width:149px;
	height:38px;
	z-index:3;
}
-->
</style>
</head>

<body id="body">
<div id="productSearch_layer" style="display:none;background:#E9E9E9">
<form id="form1" name="form1" method="post" action="cgbj_update.jsp">
  <label>
  商品名称：
  <input type="text" name="textfield" />
  </label>
  <label>
  <input type="submit" name="Submit" value="查询" />
  </label>
</form>
<table width="200" border="1">
  <tr>
    <td><div align="center">商品名称</div></td>
    <td><div align="center">型号</div></td>
    <td><div align="center">价格</div></td>
  </tr>
  <tr>
    <td>商品A</td>
    <td>a1</td>
    <td>222.00</td>
  </tr>
  <tr>
    <td>商品B</td>
    <td>b1</td>
    <td>22.00</td>
  </tr>
</table>
</div>

<form name="form1" method="post" action="cgbj_deal.jsp"  onsubmit="return valueCheckOut()">
<table width="81%" border="1">
	<tr>
		<td colspan="3">
		<table width="100%" height="40" border="0" cellpadding="2"
			cellspacing="2">
			<tr>
				<td width="73%">
				<div align="center">
				  <input name="mingCheng" type="text"
					id="mingCheng" class="unbloud"
					style="mingcheng" value="<%=cgbj.getMingCheng() %>" /> 
				  采购比价单</div>				</td>
				<td width="27%">单据编号： <input name="danJuBiaoHao" type="text"
					id="danJuBiaoHao" class="unbloud"
					style="font-size:12px;height:18px;width:90px;"  readonly="readonly" value="<%=cgbj.getDanJuBiaoHao()%>"/></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td colspan="3">
		<table width="100%" border="0" cellpadding="2" cellspacing="2">
			<tr>
				<td width="73%"><label>申购项目 <select name="xiangMuId"
					id="xiangMuId">
					
				</select>
		        类别：
				     <select
					name="biaoLeiXingMing" id="biaoLeiXingMing">
					
				</select> </label></td>
				<td width="27%">日期：<%=cgbj.getChuangJianShiJian() %></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td width="2%">
		<div align="center">情况汇总</div>
		</td>
		<td width="34%">
		<table id="testTbl" border=1>
			<tr id="tr0">
				<td width="12">
				<div align="center">序号</div>
				</td>
				<td width="96">
				<div align="center">品名</div>
				</td>
				<td width="56" id="b11">
				<div align="center">规格型号</div>
				</td>
				<td width="28" id="b11">
				<div align="center">数量</div>
				</td>
				<td width="48" id="b11">
				<div align="center" style="overflow-x:auto;width:45px">计量单位</div>
				</td>
				        <%
        Iterator cggs_iter = cggss.iterator();
        while (cggs_iter.hasNext()){
        	CaiGouGongSi gs = (CaiGouGongSi)cggs_iter.next();
        	out.println("<td bgcolor=\"#FFFFFF\"  width=\"90\" id=\"b11\"><table width=\"104\" border=\"0\" align=\"center\">"+
					"<tr><td colspan=\"2\">"+
			        "<div align=\"center\"><input name=\"cj_1\" type=\"text\" id=\"cj_1\" size=\"12\" value=\""+
			        gs.getGongSimingCheng()+"\" /></div></td></tr>"+
		            "<tr><td><div align=\"center\">报价</div></td><td><div align=\"right\">审价</div></td></tr></table></td>");
        }
        %>
		<td>历史价格</td>
			</tr>
			    <%
    Iterator iter = sps.iterator();
			    int i=1;
    while (iter.hasNext()){
    	//
    	CaiGouShangPing sp = (CaiGouShangPing)iter.next();
    	int caiGouShangPingId = sp.getCaiGouShangPingId();
    %>
			<tr id="tr1">
				<td align="center" width="20"><div align="center" style="overflow-x:auto;width:20px"><%=i %></div></td>
				<td width="120"><div style="overflow-x:auto;width:150px"><%=sp.getMingCheng() %></div></td>
				<td id="b11"><div style="overflow-x:auto;width:100px"><%=sp.getGuiGe() %></div></td>
				<td id="b11"><div style="overflow-x:auto;width:50px"><%=sp.getShuLiang() %></div></td>
				<td id="b11" align="center"><div style="overflow-x:auto;width:50px"><label><%=sp.getDanWei() %></label></div></td>
				<%
        Iterator iter_gs = cggss.iterator();
        while (iter_gs.hasNext()){
        	CaiGouGongSi val = (CaiGouGongSi)iter_gs.next();
        	//int  =m.get("");
        	out.println("<td  id=\"b11\"><div align=\"center\" style=\"overflow-x:auto;width:114px\">" +
        	"<input	name=\"bj1_1\" type=\"text\" class=\"fontff\" id=\"bj1_1\" size=\"4\"  value=\""+cgbj.getGongSiBaoJia(caiGouShangPingId, val.getGongSiId())
        	+"\" readonly/><input name=\"sj1_1\" type=\"text\" class=\"fontff\" id=\"sj1_1\" size=\"4\" " + (pageUser.isBiJiaBu()?"":" readonly") + "/></div></td>");
        }
        %>
				<td><input name="ls_1" type="text" id="ls_1" size="6"  value="<%=sp.getLiShiJiaGe() %>"/></td>
			</tr>
			
	<%  i++;
	  } %>
			<tr id="trzj">
			<td colspan="5" align="center">总价</td>
				<%
		Iterator iter_gs = cggss.iterator();
        while (iter_gs.hasNext()){
        	CaiGouGongSi val = (CaiGouGongSi)iter_gs.next();
        	//int  =m.get("");
        	out.println("<td  id=\"b11\"><div align=\"center\" style=\"overflow-x:auto;width:114px\">" +
        	"<input name=\"bjzj_1\" type=\"text\" id=\"bjzj_1\" size=\"4\" value=\""+ val.getZongBaoJia() +"\" readonly/>"+
			"<input name=\"sj1_1\" type=\"text\" class=\"fontff\" id=\"sj1_1\" size=\"4\" /></div></td>");
        }
        %>
				<td>&nbsp;</td>
			</tr>
			<tr id="trlxr">
			<td colspan="5" align="center">联系人(联系方式)</td>
				<%
        iter_gs = cggss.iterator();
        while (iter_gs.hasNext()){
        	CaiGouGongSi val = (CaiGouGongSi)iter_gs.next();
        	//int  =m.get("");
        	out.println("<td  id=\"b11\"><div align=\"center\" style=\"overflow-x:auto;width:114px\">" +
        	val.getLianXirenHeFangshi()+  
        	" </div></td>");
        }
    %>
				<td>&nbsp;</td>
			</tr>
		</table>
	  </td>
		<td width="64%" valign="top">
		<table width="200" border="1">
			<tr>
				<td height="40">
				<div align="center">备注</div>
				</td>
			</tr>
			<tr>
				<td height="170"><label> <textarea name="YouBianBeiZhu"
					rows="10" id="YouBianBeiZhu" readonly="readonly"><%=cgbj.getYouBianBeiZhu() %></textarea> 
				</label></td>
			</tr>

		</table>
	  </td>
	</tr>
	<tr>
		<td><span style="width: 12px">审核意见</span></td>
		<td colspan="2">
		<table width="100%" border="1">
			<tr>
				<td width="24%"><span
					style="height: 40px; width: 150px; text-align: left;">技术备注：</span></td>
				<td width="76%"><textarea name="XiaMianBeiZhu" cols="<%=nYiJianWidth %> rows="3" id="XiaMianBeiZhu"><%=cgbj.getXiaMianBeiZhu() %></textarea></td>
			</tr>
			<tr>
				<td><span style="width: 150px; height: 21px; text-align: left">项目组意见:</span></td>

				<td>
				<%
					if(	nUserQuanXian == SysGlobals.C_ShenHe_XiangMuZu)
					{
				%>
				  <textarea name="XiangMuZuYiJian" cols="<%=nYiJianWidth %>" rows="3"  type="text" size="50">
				   <%=cgbj.getXiangMuZouYiJian() %>
				   </textarea>
				    	<select name="s_cyyj" id="s_cyyj" width="100%"> 
                   <%
               			Set s = changyongYIJiangMap.keySet();
               			Iterator it = s.iterator();
               			int xIndex = 0;
               			while (it.hasNext())
               			{
               				String key = (String) it.next();
               				xIndex++;
               				if (key != null)
               				{
               					String val = (String) changyongYIJiangMap.get(key);
                    	 	
                 	 %>   
                   			  <option value="<%=key%>"><%=val%></option>   
      
					<%		
							}
						}
						%>        
                	</select>
				<%
					}
					else
					{
				%>
					<%=cgbj.getXiangMuZouYiJian() %>
				
				<% } %>
				</td>
			</tr>
			<tr>
				<td><span style="width: 150px; text-align: left;">采购部意见:</span></td>
				
				<td>
				<%
					if(	nUserQuanXian == SysGlobals.C_ShenHe_CaiGouBu)
					{
				%>
				  <textarea name="CaiGouBuYiJian" cols="<%=nYiJianWidth %>" rows="3"  type="text" size="50"> <%=cgbj.getCaiGouBuYiJian()%></textarea>
					 	<select name="s_cyyj" id="s_cyyj" width="100%"> 
                   <%
               			Set s = changyongYIJiangMap.keySet();
               			Iterator it = s.iterator();
               			int xIndex = 0;
               			while (it.hasNext())
               			{
               				String key = (String) it.next();
               				xIndex++;
               				if (key != null)
               				{
               					String val = (String) changyongYIJiangMap.get(key);
                    	 	
                 	 %>   
                   			  <option value="<%=key%>"><%=val%></option>   
      
					<%		
							}
						}
						%>        
                	</select>
				<%
					}
					else
					{
				%>
					<%=cgbj.getCaiGouBuYiJian()	%>
				
				<% } %>
				</td>
			</tr>
			<tr>
				<td><span style="width: 150px; text-align: left">比价部意见:</span></td>
				<td>
				<%
					if(	nUserQuanXian == SysGlobals.C_ShenHe_BiJiaBu)
					{
				%>
				  <textarea name="BiJiaBuYiJian" cols="<%=nYiJianWidth %>" rows="3"  type="text" size="50"> <%=cgbj.getBiJiaBuYiJian()%></textarea>
				   	<select name="s_cyyj" id="s_cyyj" width="100%"> 
                   <%
               			Set s = changyongYIJiangMap.keySet();
               			Iterator it = s.iterator();
               			int xIndex = 0;
               			while (it.hasNext())
               			{
               				String key = (String) it.next();
               				xIndex++;
               				if (key != null)
               				{
               					String val = (String) changyongYIJiangMap.get(key);
                    	 	
                 	 %>   
                   			  <option value="<%=key%>"><%=val%></option>   
      
					<%		
							}
						}
						%>        
                	</select>
				
				<%
					}
					else
					{
				%>
					<%=cgbj.getBiJiaBuYiJian()	%>
				
				<% } %>
				</td>
			</tr>
			<tr>
				<td><span style="width: 150px; text-align: left">中心总经理批示:</span></td>
				<td>
				<%
					if(	nUserQuanXian == SysGlobals.C_ShenHe_JingLi)
					{
				%>
				  <textarea name="ZhongXinJingLiYiJian" cols="<%=nYiJianWidth %>" rows="3"  type="text" size="50">
				   <%=cgbj.getZhongXinJingLiYiJian()%></textarea>
				   	<select name="s_cyyj" id="s_cyyj" width="100%"> 
                   <%
               			Set s = changyongYIJiangMap.keySet();
               			Iterator it = s.iterator();
               			int xIndex = 0;
               			while (it.hasNext())
               			{
               				String key = (String) it.next();
               				xIndex++;
               				if (key != null)
               				{
               					String val = (String) changyongYIJiangMap.get(key);
                    	 	
                 	 %>   
                   			  <option value="<%=key%>"><%=val%></option>   
      
					<%		
							}
						}
						%>        
                	</select>
				<%
					}
					else
					{
				%>
					<%=cgbj.getZhongXinJingLiYiJian()%>
				
				<% } %>
				</td>
				</tr>
			<tr>
				<td><span style="width: 150px; text-align: left;">分管总裁批示:</span></td>
			 				<td>
				<%
					if(	nUserQuanXian == SysGlobals.C_ShenHe_ZhongCai)
					{
				%>
				  <textarea name="FenGuanZongCaiYiJian" cols="<%=nYiJianWidth %>" rows="3"  type="text" size="50">
				   <%=cgbj.getFenGuanZongCaiYiJian()%></textarea>
				   	<select name="s_cyyj" id="s_cyyj" width="100%"> 
                   <%
               			Set s = changyongYIJiangMap.keySet();
               			Iterator it = s.iterator();
               			int xIndex = 0;
               			while (it.hasNext())
               			{
               				String key = (String) it.next();
               				xIndex++;
               				if (key != null)
               				{
               					String val = (String) changyongYIJiangMap.get(key);
                    	 	
                 	 %>   
                   			  <option value="<%=key%>"><%=val%></option>   
      
					<%		
							}
						}
						%>        
                	</select>
				<%
					}
					else
					{
				%>
					<label><%=cgbj.getFenGuanZongCaiYiJian()%></label>
				
				<% } %>
				</td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<br />
<label>
<input type="button" name="Submit2" value="打印预览">
</label>
<label>
	<%
		if(	nUserQuanXian == SysGlobals.C_ShenHe_ZhongCai)
		{
	%>
					<input
	type="submit" name="Submit" value="同意"/>
		<input
	type="submit" name="Submit" value="拒绝"/>
	
	<% }
		else if(nUserQuanXian == SysGlobals.C_ShenHe_JingLi)
		{
	%>
			<input
	type="submit" name="Submit" value="提交"/>
		<input
	type="submit" name="Submit" value="结束审批"/>
	<%  }
		else
		{
	%>
			<input
			type="submit" name="Submit" value="提交"/>
	<%} %>
	


	
	 <input type="button"
	onClick="displayDiv()" value="商品查询"></label> <input name="row"
	type="hidden" id="row" value="7"> <input name="column "
	type="hidden" id="column " value="7"> <INPUT id=factorys
	type=hidden value=3 name=factorys> <input id=products
	type=hidden value=5 name=products>
 采购员： 
 <input type="text" name="yuanGongId" readonly="readonly" value="">
 </form>

</body>
</html>
